unit RaDes;

interface

uses
  SysUtils, Classes, DEsReal;

type
  TRaDes = class(TComponent)
  private
    fAuthor: string;
    fStr: string;
    fKey: string;
    fCode: string;
  protected
  public
    constructor Create(AOwner: TComponent); override;
    function DesCode: string;
    function DesCodeHex: string;
    function UnDexCode: string;
    function UnDexCodeHex: string;
  published
    property OriginalString: string read fStr write fStr;
    property KeyString: string read fKey write fKey;
    property CodedString: string read fCode write fCode;
    property Author: string read fAuthor;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Rarnu Components', [TRaDes]);
end;

{ TRaDes }

constructor TRaDes.Create;
begin
  inherited;
  fStr := '';
  fKey := '';
  fAuthor := 'Rarnu -- http://rarnu.ik8.com';
end;

function TRaDes.DesCode: string;
begin
  result := DEsReal.EncryStr(OriginalString, KeyString);
end;

function TRaDes.DesCodeHex: string;
begin
  result := DEsReal.EncryStrHex(OriginalString, KeyString);
end;

function TRaDes.UnDexCode: string;
begin
  result := DEsReal.DecryStr(CodedString, KeyString);
end;

function TRaDes.UnDexCodeHex: string;
begin
  result := DEsReal.DecryStrHex(CodedString, KeyString);
end;

end.
